import { toSuccess, useEntityManager } from "@sker/core"
import { useData } from "@sker/runtime"
import { AutoTask } from "@sker/entities"
import { z } from "zod"

export default async () => {
    const input = z.object({
        id: z.string()
    })
    const body = input.parse(useData())
    const data = await useEntityManager(async m => {
        const task = await m.findOne(AutoTask, { where: { id: parseInt(body.id) } })

        return task;
    })
    return toSuccess(data)
}
